Skip to content
This repository was archived by the owner on Mar 26, 2025. It is now read-only.

Conversation

@jrwren
Copy link

@jrwren jrwren commented Aug 15, 2023

Description

enable pprof for #1038

Type of Change

  • New Feature

Checklist

  • I have read the contributing guidelines
  • Existing issues have been referenced (where applicable)
  • I have verified this change is not present in other open pull requests

@jrwren jrwren requested a review from a team as a code owner August 15, 2023 15:02
main.go Outdated
setupLog.Error(err, "unable to start manager")
os.Exit(1)
}
mgr.AddMetricsExtraHandler("/debug/pprof/", http.HandlerFunc(pprof.Index))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@bartam1 bartam1 Aug 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably we should also add these:

		mgr.AddMetricsExtraHandler("/debug/pprof/cmdline", http.HandlerFunc(pprof.Cmdline))
		mgr.AddMetricsExtraHandler("/debug/pprof/profile", http.HandlerFunc(pprof.Profile))
		mgr.AddMetricsExtraHandler("/debug/pprof/symbol", http.HandlerFunc(pprof.Symbol))
		mgr.AddMetricsExtraHandler("/debug/pprof/trace", http.HandlerFunc(pprof.Trace))

@jrwren jrwren requested a review from bartam1 August 18, 2023 14:45
main.go Outdated
}

if enableprofile {
mgr.AddMetricsExtraHandler("/debug/pprof/", http.HandlerFunc(pprof.Index))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to check the returned error here and for the other mgr.AddMetricsExtraHandler cases.

err = mgr.AddMetricsExtraHandler("/debug/pprof/", http.HandlerFunc(pprof.Index))
if err != nil {
	setupLog.Error(err, "unable to attach pprof to webserver")
	os.Exit(1)
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants